package com.leapcloud.crm.core.vo;

import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.Max;
import java.io.Serializable;
import java.util.List;

/**
 * @author wangzhenyan
 * @email ffu@maxleap.com
 * @since 2018/8/29 16:39
 */
@Data
public class PageVO<T> implements Serializable {
  @Max(value = Integer.MAX_VALUE, message = "页数超过最大值")
  private int pageNum = 1;
  @Max(value = 500, message = "每页条数最多为500条")
  private int pageSize = 15;

  private List<Order> orderFields;

  @Valid
  private T params;


  @Data
  public static class Order {
    private String name;
    private Sort sort = Sort.DEFAULT;
  }

  public static enum Sort {
    DEFAULT,
    DESC,
    ASC
  }

}
